﻿<?xml version="1.0" encoding="utf-8"?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="ACompany.OrderProcessing.Model"
                   assembly="ACompany.OrderProcessing.Model">

  <class name="ACompany.OrderProcessing.Model.Item" table="OrderItems" lazy="false">

    <id name="Id" column="id" type="guid">
      <generator class="guid" />
    </id>

    <!-- Many-to-one mapping: Product -->
    <many-to-one name="Product" class="Product" column="ProductId" cascade="all" not-null="true" />

    <property name="Qty">
      <column name="Qty" sql-type="int" not-null="true" />
    </property>

    <property name="Price">
      <column name="Price" sql-type="decimal(18, 2)" not-null="true" />
    </property>

    <!-- Many-to-one mapping: Order -->
    <many-to-one name="Order" class="Order" column="OrderID" cascade="all" not-null="true" />
  </class>

</hibernate-mapping>